/**
 * 
 */
package com.wrsr.examsys.base.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.wrsr.examsys.base.dao.BaseDao;
import com.wrsr.examsys.base.service.BaseService;

/**
 * @author <a href="mailto:2397431783@qq.com">wangruishun</a>
 * @version examsy1.0 2014年12月26日 下午5:10:45
 */
@SuppressWarnings("rawtypes")
public class BaseServiceImpl<T> implements BaseService<T> {

	private BaseDao dao;

	@Resource
	public void setDao(BaseDao dao) {
		this.dao = dao;
	}

	@SuppressWarnings("unchecked")
	public void saveEntity(T t) {
		dao.saveEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void updateEntity(T t) {
		dao.updateEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void deleteEntity(T t) {
		dao.deleteEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void saveOrUpdateEntity(T t) {
		dao.saveOrUpdateEntity(t);
	}

	public void batchEntityByHQL(String hql, Object... objects) {
		dao.batchEntityByHQL(hql, objects);
	}

	@SuppressWarnings("unchecked")
	public List<T> findEntityByHQL(String hql, Object... objects) {

		return dao.findEntityByHQL(hql, objects);
	}

	@SuppressWarnings("unchecked")
	public T getEntity(String id) {

		return (T) dao.getEntity(id);
	}

	@SuppressWarnings("unchecked")
	public T loadEntity(String id) {

		return (T) dao.loadEntity(id);
	}

	@SuppressWarnings("unchecked")
	public T getEntity(Integer id) {

		return (T) dao.getEntity(id);
	}

	@SuppressWarnings("unchecked")
	public T loadEntity(Integer id) {

		return (T) dao.loadEntity(id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.wrsr.examsys.base.service.BaseService#getListForPage(java.lang.String
	 * , int, int)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<T> getListForPage(String hql, int offset, int length) {
		return dao.getListForPage(hql, offset, length);
	}

}
